﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<c:set var="grant_code">
    <x:out escapeXml="false"     select="$xmlData/data/proposal/grant_code" />
</c:set>
<c:set var="sub_grant_code">
    <x:out escapeXml="false"     select="$xmlData/data/proposal/sub_grant_code" />
</c:set>


<div class="t_bar">资金预算（万元）</div>
<table  id="eq_table1" cellpadding="0" class="table01 t_css" width="100%" border="0" cellpadding="0" style="*border-bottom: #a1c0dc 1px solid;">

    <tr class="t_tr">
        <td align="center" width="20%" rowspan="2">资金来源预算</td>
        <td align="center" width="20%" rowspan="2">预算金额</td>
        <td align="center" width="60%"  colspan="3">其中</td>
    </tr>
    <tr>
        <td align="center"><x:out escapeXml="false"     select="$xmlData/data/budget/select_yea1" />年</td>
        <td align="center"><x:out escapeXml="false"     select="$xmlData/data/budget/select_yea2" />年</td>
        <td align="center"><x:out escapeXml="false"  select="$xmlData/data/budget/select_yea3" />年</td>
    </tr>
    <tr>
        <td align="left" style="padding-left:20px">1、省财政拨款</td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail_from/invest[@invest_code='00']/total_each" />
        </td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail_from/invest[@invest_code='00']/total_invest_yea1" />
        </td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail_from/invest[@invest_code='00']/total_invest_yea2" />
        </td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail_from/invest[@invest_code='00']/total_invest_yea3" />
        </td>
    </tr>
    <tr>
        <td align="left" style="padding-left:20px">2、市（县）财政拨款</td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail_from/invest[@invest_code='01']/total_each" />
        </td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail_from/invest[@invest_code='01']/total_invest_yea1" />
        </td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail_from/invest[@invest_code='01']/total_invest_yea2" />
        </td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail_from/invest[@invest_code='01']/total_invest_yea3" />
        </td>
    </tr>
    <tr>
        <td align="left" style="padding-left:20px">3、单位自筹经费</td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail_from/invest[@invest_code='02']/total_each" />
        </td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail_from/invest[@invest_code='02']/total_invest_yea1" />
        </td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail_from/invest[@invest_code='02']/total_invest_yea2" />
        </td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail_from/invest[@invest_code='02']/total_invest_yea3" />
        </td>
    </tr>
    <tr>
        <td align="left" style="padding-left:40px">其中：银行贷款</td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail_from/invest[@invest_code='03']/total_each" />
        </td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail_from/invest[@invest_code='03']/total_invest_yea1" />
        </td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail_from/invest[@invest_code='03']/total_invest_yea2" />
        </td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail_from/invest[@invest_code='03']/total_invest_yea3" />
        </td>
    </tr>
    <tr>
        <td align="left" style="padding-left:20px">4、其它经费来源</td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail_from/invest[@invest_code='04']/total_each" />
        </td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail_from/invest[@invest_code='04']/total_invest_yea1" />
        </td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail_from/invest[@invest_code='04']/total_invest_yea2" />
        </td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail_from/invest[@invest_code='04']/total_invest_yea3" />
        </td>
    </tr>
    <tr>
        <td align="center"><strong>来源合计</strong></td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail_from/invest[@invest_code='05']/total_investfrom" />
        </td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail_from/invest[@invest_code='05']/total_invest_yea1" />
        </td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail_from/invest[@invest_code='05']/total_invest_yea2" />
        </td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail_from/invest[@invest_code='05']/total_invest_yea3" />
        </td>
    </tr>
</table>
<table  id="eq_table1" cellpadding="0" class="t_css table01" width="100%" border="0" cellpadding="0" style="*border-bottom: #a1c0dc 1px solid;">
    <tr class="t_tr">
        <td align="center" width="20%">资金支出预算</td>
        <td align="center" width="22%">预算金额</td>
        <td align="center" width="23%">省级财政资金</td>
        <td align="center" width="35%">备注</td>
    </tr>
    <tr >
        <td align="left" style=""><strong>一、直接费用</strong></td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail/invest[@invest_code='00']/total_invest" />
        </td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail/invest[@invest_code='00']/total_fund" />
        </td>
        <td align="center">
            <%--<x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail/invest[@invest_code='00']/total_allot" />--%>
            \
        </td>

    </tr>
    <tr >
        <td align="left" style="padding-left:20px" >1、设备费</td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail/invest[@invest_code='01']/total_invest" />
        </td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail/invest[@invest_code='01']/total_fund" />
        </td>
        <td align="center">
            <%--<x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail/invest[@invest_code='01']/total_allot" />--%>
            \
        </td>

    </tr>

    <tr >
        <td align="left" style="padding-left:40px" >（1）购置设备费</td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail/invest[@invest_code='02']/total_invest" />
        </td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail/invest[@invest_code='02']/total_fund" />
        </td>
        <td >
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail/invest[@invest_code='02']/total_allot" />
        </td>

    </tr>
    <tr >
        <td align="left" style="padding-left:40px" >（2）自制设备费</td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail/invest[@invest_code='03']/total_invest" />
        </td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail/invest[@invest_code='03']/total_fund" />
        </td>
        <td >
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail/invest[@invest_code='03']/total_allot" />
        </td>

    </tr>
    <tr >
        <td align="left" style="padding-left:40px" >（3）设备改造与租赁</td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail/invest[@invest_code='04']/total_invest" />
        </td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail/invest[@invest_code='04']/total_fund" />
        </td>
        <td >
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail/invest[@invest_code='04']/total_allot" />
        </td>

    </tr>
    <tr >
        <td align="left" style="padding-left:20px">2、业务费</td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail/invest[@invest_code='05']/total_invest" />
        </td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail/invest[@invest_code='05']/total_fund" />
        </td>
        <td >
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail/invest[@invest_code='05']/total_allot" />
        </td>
    </tr>
    <tr >
        <td align="left" style="padding-left:20px">3、劳务费</td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail/invest[@invest_code='06']/total_invest" />
        </td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail/invest[@invest_code='06']/total_fund" />
        </td>
        <td >
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail/invest[@invest_code='06']/total_allot" />
        </td>
    </tr>
    <tr >
        <td align="left" style=""><strong>二、间接费用</strong></td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail/invest[@invest_code='07']/total_invest" />
        </td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail/invest[@invest_code='07']/total_fund" />
        </td>
        <td >
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail/invest[@invest_code='07']/total_allot" />
        </td>
    </tr>

    <tr >
        <td align="center" ><strong>支出合计</strong></td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail/invest[@invest_code='08']/total_invest" />
        </td>
        <td align="center">
            <x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail/invest[@invest_code='08']/total_fund" />
        </td>
        <td align="center">
            <%--<x:out escapeXml="false"     select="$xmlData/data/budget/invest_detail/invest[@invest_code='08']/total_allot" />--%>
            \
        </td>
    </tr>
</table>
</br>
<div class="t_bar">预算说明</div>
<table id="tbl" cellpadding="0" class="table01 t_css" width="100%" border="0" cellpadding="0" style="*border-bottom: #a1c0dc 1px solid;word-break: break-word">
    <col style="width:34%"/>
    <col style="width:40%"/>
    <col style="width:13%"/>
    <col style="width:13%"/>
    <tr>
        <td colspan="4">
            <p >根据《关于改革完善省级财政科研经费管理的若干措施》（皖财教〔2022〕134号）相关规定执行。</p>
            <p >直接费用中除50万元以上的设备费外，其他费用只提供基本测算说明，不需要提供明细。计算类仪器设备和软件工具可在设备费科目列支。</p>
        </td>
    </tr>
    <tr>
        <td colspan="4">
            <x:out escapeXml="false"     select="$xmlData/data/project/budget_description_hidden" />
        </td>
    </tr>
</table>


<script type="text/javascript">
    $(function(){
        // changeCss();
        fileInit_1("tblMileStones1","PDF",null,"{'PDF':'20480'}");
        $("#tblMileStones1").find(".file").hide();

    });
    function changeCss() {
        $("table.t_css").each(function(){
            $(this).find("tr:even").removeClass().addClass("li_1");
            $(this).find("tr:odd").removeClass().addClass("li_2");
        });
        changeCss1("fundInfo","tblMileStones1");
    }
    function changeCss1(id1,id2) {
        if($("#"+id1+" tr:last").attr("class")=="li_1"){
            $("#"+id2+" tr").removeClass("li_1").addClass("li_2");
        }else{
            $("#"+id2+" tr").removeClass("li_2").addClass("li_1");
        }
    }



    function uploadfile(index,i){
        if(2==index){
            $("#proof_file_data").click();

        }
        else
            $("#card_file").click();
    }
    /* function show(index){
        $("#kepu").find("#proof_file"+index).show();
    } */
    function fileInit_1(tableId, type, width, validateJson) {
        var imgres="";

        if(locale=="en_US"){
            imgres="Upload_EN.gif";

        }else{
            imgres="Upload_2.gif";

        }
        $("#" + tableId).find(":file").filestyle({
            image : res + "/images/"+imgres,
            imageheight : 25,
            imagewidth : 56,
            width : width
        });
        $("#" + tableId).find(":file").not("#filedata\\[0\\]").each(function(i) {
            $(this).change(function() {
                var str = $(this).attr("id");
                var index = str.charAt(str.length - 1);
                showFileName_1($(this), tableId, type, validateJson,index);
            });
        });
    }

    function showFileName_1(obj, tableId, type, validateJson,index) {
        var max = null;
        var fileTblId=null;// 文件列表的表格id

        fileTblId=tableId;
        var filedata = obj.val();
        if (filedata == '')
            return;
        else if(max!=null && $.isNumeric(max) && fileTblId!=null && $("#"+fileTblId+" tr:gt(1)").length>=max){
            var label="";
            if($("#"+fileTblId).attr("label")!=null)
                label=$("#"+fileTblId).attr("label");

            scmWarn(label+messageTip.canNotUploadMoreThan+max+messageTip.files1);
            return;
        } else {
            var fileName = filedata.substring(filedata.replace(/\\/g, '/')
                .lastIndexOf('/') + 1);
            var end = fileName.substring(fileName.lastIndexOf(".") + 1,
                fileName.length).toUpperCase();
            if (type.indexOf(end) < 0) {
                scmWarn(messageTip.pleaseUpload + type + messageTip.files2, "100px");
                return;
            }
        }

        $("#" + tableId + " .file").val(fileName);
        ajaxFileUpload_1(obj,"orgattach", tableId, type, max, validateJson,index);
    }

    function ajaxFileUpload_1(obj,type, tblId, filetype, max, validateJson,index) {
        irisAjaxFileUpload_1(obj,type, tblId, filetype, max, validateJson,index);
    }

    function uploadSuccess_1(obj,data, tableId, filetype,index){
        $("#"+tableId).find("#file_code"+index).val(data[data.length-1].fileCode);
        $("#"+tableId).find("#file_name"+index).text(data[data.length-1].fileName);
        $("#"+tableId).find("#file_url"+index).attr("href", downloadPath + data[data.length-1].fileCode);
        $("#proof_file"+index).show();
        $("#sy_delConent"+index).show();

        /*              var fileDate = $("#" + tableId).find("span[id='file_date'"+index+"]");// 上传时间对象
        */
        var fileDate = $("#" + tableId).find("#file_date"+index);// 上传时间对象
        var nowTime = showLocale(new Date());
        fileDate.text(nowTime);
        $("#"+tableId).find("#"+index).show();
    }

    function irisAjaxFileUpload_1(obj,type, tableId, fileType, max, validateJson,index) {
        if (type == null || type == '') {
            scmWarn(messageTip.pleaseEnterTypeOfAttachment);
            return;
        }
        $("#"+tableId+" input[type='file']").not(obj).each(function(){
            this.outerHTML=this.outerHTML.replace(/(value=\").+\"/i,"$1\"");
        });


        prcWin.openWin();// 打开遮罩层
        $.ajaxFileUpload({
            url : ctx + '/file/ajax-fileupload',// 请求地址
            secureuri : false,// 一般设置为false
            fileElementId : 'filedata',// 文件的id属性
            limitSize : '10',// 允许上传的文件大小,单位M
            allowType : '',// 允许上传的文件类型.
            data : {
                'type' : type,
                'validateJson':validateJson
            },
            tableId : tableId,// tableID
            dataType : 'json',// 返回值类型
            success : function(data, status) // 服务器成功响应处理函数
            {
                if (data.result == 'error') {
                    scmWarn(data.msg);
                } else {

                    uploadSuccess_1(obj,data, tableId, fileType,index);


                    $("#"+tableId).find(":file").not("#filedata\\[0\\]").each(function(i) {
                        fileType="JPG，PNG，DOC，WPS，DOCX，PDF，XLS，XLSX，TIFF，RAR";
                        validateJson="{'JPG':'20480','PNG':'20480','DOC':'20480','WPS':'20480','DOCX':'20480','PDF':'20480','XLS':'20480','XLSX':'20480','TIFF':'20480','RAR':'20480'}";
                        $(this).unbind("change");
                        $(this).change(function() {
                            var str = $(this).attr("id");
                            var index = str.charAt(str.length - 1);
                            showFileName_1($(this), tableId, fileType, validateJson,index);
                        });
                    });
                }
                prcWin.closeWin();// 关闭遮罩层
            },
            error : function(data, status, e)// 服务器响应失败处理函数
            {
                $("#"+tableId+" input[type='file']").each(function(j) {
                    this.outerHTML=this.outerHTML.replace(/(value=\").+\"/i,"$1\"");
                });


                $("#"+tableId).find(":file").not("#filedata\\[0\\]").each(function(i) {
                    fileType="JPG，PNG，DOC，WPS，DOCX，PDF，XLS，XLSX，TIFF，RAR";
                    validateJson="{'JPG':'20480','PNG':'20480','DOC':'20480','WPS':'20480','DOCX':'20480','PDF':'20480','XLS':'20480','XLSX':'20480','TIFF':'20480','RAR':'20480'}";
                    $(this).unbind("change");
                    $(this).change(function() {
                        showFileName_1($(this), "mainGoodsInfo", fileType, validateJson,index);
                    });
                });
                if (data && data.responseText && data.responseText.indexOf('413') > -1) {
                    scmError("上传的文件超过限制大小！");
                } else {
                    scmError(status);
                }
                prcWin.closeWin();// 关闭遮罩层
            },
            complete:function()
            {
                prcWin.closeWin();// 关闭遮罩层
            }
        });

    }
    function countFundAuto(idStart, countStr, totalStr) {
        var indexs = countStr.split(",");
        var count = 0;
        for ( var i = 0; i < indexs.length; i++) {
            var fund = $("#" + idStart + indexs[i]).val();
            if (!$.isNumeric(fund))
                fund = "0";
            count = ((parseFloat(count)*10000 + parseFloat(fund)*10000)/10000).toFixed(2);
            /*count = ((parseFloat(count)*100 + parseFloat(fund)*100)/100).toFixed(2);*/
            /*count = parseFloat(count) + parseFloat(fund);*/

        }


        count = formatNumberAuto(count.toString(), 9, 2, 2);// 格式化金额

        //add by cg 扩展：对于多个输入框所求得的和，同时赋给某几个文本框
        var totalStrArr = totalStr.split(",");
        var totalId;
        for(var i = 0;i < totalStrArr.length; i++ ) {
            totalId = totalStrArr[i];

            $("#" + idStart + totalId).val(count);
        }
    }

    function delContent_1(tableId,index) {
        if (confirm("你确定要删除该附件？")) {
            /* $("#" + tableId).find("input[id='file_code']").val("");// 清空文件名
            $("#" + tableId).find("span[id='file_date']").text("");// 清空文件code
            $("#" + tableId).find("span[id='file_name']").text("");// 清空文件上传日期
            $("#"+tableId).find("#proof_content").hide(); */

            $("#" + tableId).find("#file_code"+index).val("");// 清空文件名
            $("#" + tableId).find("#file_date"+index).text("");// 清空文件code
            $("#" + tableId).find("#file_name"+index).text("");// 清空文件上传日期
            $("#"+tableId).find("#proof_content"+index).hide();

            $("#sy_delConent"+index).hide();
            $("#file"+index).val("");
            $("#proof_file"+index).hide();

            /* $("#" + tableId).find("#proof_file"+index).hide(); */

        }
    }

    /**
     * 数字显示函数，适用于可输入四位小数或二位少数
     * number:值
     * maxIntLength:整数部分最大长度,
     * maxDecimalLength:小数部分最大长度,
     * displayDecimal:小数部分显示出的长度
     */
    function formatNumberAuto(number,maxIntLength,maxDecimalLength,displayDecimal) {
        if(number.indexOf(".") !=number.lastIndexOf(".")){
            number = number.substring(0,number.lastIndexOf("."))+ ''+ number.substring(number.lastIndexOf(".")+1);
        }
        if(number.indexOf(".")>=0){//如果是输入值中带有小数点则检查小数部分长度是否达到了最低显示的长度，如果没有则补0
            var integral="";
            var decimal="";
            if (number.indexOf(".")==0&&number.length>1){
                integral="0";
                decimal=number.substring(1,number.length);
            }else if (number.indexOf(".")>0){
                integral=number.substring(0,number.indexOf("."));
                decimal=number.substring(number.indexOf(".")+1,number.length);
            }
            var f=decimal.substring(displayDecimal,maxDecimalLength);
            //小数四位，如果后两位为00，就去掉
            if(f=="00"){
                decimal=decimal.substring(0, displayDecimal);
            }else{
                decimal=decimal.substring(0, maxDecimalLength);
            }
            number=integral+"."+decimal;
        }else if (number!=""&&displayDecimal>0){//输入的是整数则补上小数部分，全部为0
            number=number+".";
            for (var i=0;i<displayDecimal;i++){
                number=number+"0";
            }
        }
        return number;
    };

</script>